home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * (a) (C) 1990 by Adobe Systems Incorporated. All rights reserved.
- *
- * (b) If this Sample Code is distributed as part of the Display PostScript
- * System Software Development Kit from Adobe Systems Incorporated,
- * then this copy is designated as Development Software and its use is
- * subject to the terms of the License Agreement attached to such Kit.
- *
- * (c) If this Sample Code is distributed independently, then the following
- * terms apply:
- *
- * (d) This file may be freely copied and redistributed as long as:
- * 1) Parts (a), (d), (e) and (f) continue to be included in the file,
- * 2) If the file has been modified in any way, a notice of such
- * modification is conspicuously indicated.
- *
- * (e) PostScript, Display PostScript, and Adobe are registered trademarks of
- * Adobe Systems Incorporated.
- *
- * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
- * CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
- * AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
- * ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
- * OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
- * WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
- * WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
- * DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
- * OF THIRD PARTY RIGHTS.
- */
-
- /*
- * epsferror.c
- *
- * Version: 2.0
- * Author: Ken Fromm
- * History:
- * 03-07-91 Added this comment.
- */
-
- #import "epsfstruct.h"
-
- #import <appkit/nextstd.h>
- #import <dpsclient/dpsclient.h>
- #import <dpsclient/wraps.h>
- #import <streams/streamsimpl.h>
-
- static char *errorStrings[ ] =
- {
- /* EPSF_OK */ "EPSF file ok. ",
- /* EPSF_INVALIDPS */ "Not a valid EPSF file. ",
- /* EPSF_INVALIDPAGECOUNT */ "Invalid page count in EPSF file. ",
- /* EPSF_INVALIDBBOX */ "Invalid bounding box for the EPSF file. ",
- /* EPSF_INVALIDDOCUMENT */ "Invalid document included in the EPSF file. ",
- /* EPSF_ENDFILE */ "End file unexpectedly encountered in EPSF file. ",
- /* EPSF_WRITEERROR */ "Errors have been encountered in this EPSF file. ",
- /* EPSF_UNDEFINED */ "Undefined error in EPSF file. "
- };
-
- char *ErrorEpsf(int errorcode)
- {
- errorcode = MIN(errorcode, EPSF_ERRORCOUNT);
- return (errorStrings[errorcode]);
- }
-
- /* Log the error into a stream and then write the stream to stderr. */
- void LogEpsfError(NXHandler *NXLocalHandler)
- {
- char *edata;
-
- int elen, emaxlen;
-
- NXStream *estream;
-
- estream = NXOpenMemory(NULL, 0, NX_WRITEONLY);
- DPSPrintErrorToStream(estream, (DPSBinObjSeq) (NXLocalHandler->data2));
- NXFlush(estream);
- NXGetMemoryBuffer(estream, &edata, &elen, &emaxlen);
- NXLogError("%s\n", edata);
- NXCloseMemory(estream, NX_FREEBUFFER);
- }
-